<?php


$url = "http://api.monitorix.biz/app?c=jGcDJfabZTBTwB";
//$url = "http://delo.ua/rss/144/";

$data = "";
foreach( $_GET as $key => $value){
      //$data = $data . "&" . $key . "=" . utf8_decode($value);
      $data = $data . "&" . $key . "=" . $value;
} 

$response = do_post_request ( $url, $data ); 

print $response; 
	
function do_post_request($url, $data, $optional_headers = null) 
{ 
     
      //return $url. $data;
      //$str = file_get_contents($url . $data);
      //return $str;
      $handle = fopen($url . $data, "rb");
      $contents = '';
      while (!feof($handle)) {
            $contents .= fread($handle, 8192);
      }
      fclose($handle);
      return $contents; 
      
      
      /*
      $params = array('http' => array( 
            'method' => 'get', 
            'header' => "Content-Type: text/xml; charset=utf-8";
      )); 
      
      if ($optional_headers!== null) { 
            $params['http']['header'] = $optional_headers; 
      } 
      $ctx = stream_context_create($params); 
      $fp = @fopen($url . $data, 'rb', false, $ctx); 
      if (!$fp) { 
            return "Problem with" .  $url . $php_errormsg; 
      } 
      $response = @stream_get_contents($fp); 
      if ($response === false) { 
            return "Problem reading data from" . $url . $php_errormsg; 
      } 
      
      return $response;
      */
      
}

?>
